﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace ExportImportToFromFile
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = @"G:\Леся\Репозиторий\Inteducation2\LesyaSmagliy\ExportImportToFromFile\Path\List of students.txt";
            StudentsList list = new StudentsList();
            int n = 1;

            string choice;
            do
            {
                Student newStudent = new Student();
                Console.WriteLine("Enter student's first name: ");
                newStudent.firstName = Console.ReadLine();
                Console.WriteLine("Enter student's last name: ");
                newStudent.lastName = Console.ReadLine();
                newStudent.id = n;
                n++;
                list.students.Add(newStudent);
                Console.WriteLine("Add new student to list? Y/N");
                choice = Console.ReadLine();
            }
            while (choice == "Y");

            list.ExportToFile(path);

            // Test
            Console.WriteLine("From file:");
            StudentsList importTestList = StudentsList.ImportFromFile(path);
            importTestList.PrintToConsole();
            Console.ReadKey();
        }
        
    }
}
